package com.fh.controller.system.city;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fh.controller.base.BaseController;
import com.fh.service.system.city.CityService;
import com.fh.util.AppUtil;
import com.fh.util.PageData;

/**
 * 
 * @包名 :com.fh.controller.system.company
 * @文件名 :CompanyController.java
 *      TODO 类作用：公司
 * @Author: 孙超文 386480250@qq.com
 * @Date: 2015-7-2 下午5:37:33
 */
@Controller
@RequestMapping(value = "/city")
public class CityController extends BaseController {
	@Resource(name = "CityService")
	private CityService cityService;

	/**
	 * 
	 * TODO 方法作用：级联城市
	 * 
	 * @param session
	 * @param page
	 * @return
	 * @throws Exception
	 * @Author: 孙超文
	 * @Date: 2015-7-2 上午9:42:11
	 */
	@ResponseBody
	@RequestMapping(value = "/cityTree")
	public Object cityTree() {
		Map<String, Object> map = new HashMap<String, Object>();
		PageData pd = new PageData();
		pd = this.getPageData();

		List<PageData> list = new ArrayList<PageData>();
		try {
			list = cityService.listAll(pd);
		} catch (Exception e) {
			e.printStackTrace();
		}
		map.put("result", "success");
		map.put("data", list);
		return AppUtil.returnObject(new PageData(), map);
	}
}
